home *** CD-ROM | disk | FTP | other *** search
/ SGI Developer Toolbox 6.1 / SGI Developer Toolbox 6.1 - Disc 4.iso / src / tutorials / custEducation / opengl1 / include / auxPrivate.h < prev    next >
Encoding:
C/C++ Source or Header  |  1994-08-02  |  5.1 KB  |  190 lines

  1. /*
  2.  * Copyright 1993, 1994, Silicon Graphics, Inc.
  3.  * All Rights Reserved.
  4.  *
  5.  * This is UNPUBLISHED PROPRIETARY SOURCE CODE of Silicon Graphics, Inc.;
  6.  * the contents of this file may not be disclosed to third parties, copied or
  7.  * duplicated in any form, in whole or in part, without the prior written
  8.  * permission of Silicon Graphics, Inc.
  9.  *
  10.  * RESTRICTED RIGHTS LEGEND:
  11.  * Use, duplication or disclosure by the Government is subject to restrictions
  12.  * as set forth in subdivision (c)(1)(ii) of the Rights in Technical Data
  13.  * and Computer Software clause at DFARS 252.227-7013, and/or in similar or
  14.  * successor clauses in the FAR, DOD or NASA FAR Supplement. Unpublished -
  15.  * rights reserved under the Copyright Laws of the United States.
  16.  */
  17.  
  18.  
  19. #include <GL/glx.h>
  20.  
  21. #ifdef DEBUG3    /* Event processing debugging level */
  22. #define DEBUG
  23. #endif
  24.  
  25. #ifdef DEBUG2    /* Toolkit debugging level */
  26. #define DEBUG
  27. #endif
  28.  
  29. #ifdef DEBUG     /* Window debugging level */
  30. #include <auxDebug.h>
  31. #endif
  32.  
  33. /**************************************************************************
  34.  *   Global Limits
  35.  **************************************************************************/
  36.  
  37. #define MAX_ATTRIB          32
  38. #define NUM_MOUSE_BUTTONS   3
  39.  
  40.  
  41. /**************************************************************************
  42.  *    Enums
  43.  **************************************************************************/
  44.  
  45. enum {
  46.     MINUS_ONE = -1, ZERO, ONE, TWO, THREE, FOUR,
  47.     FIVE, SIX, SEVEN, EIGHT, NINE, TEN
  48. };
  49.  
  50.  
  51. /**************************************************************************
  52.  *   auxWindow - window structure
  53.  **************************************************************************/
  54.  
  55. typedef struct _auxWindow {
  56.     
  57.     GLint                 id;
  58.     GLint                 x;
  59.     GLint                 y;
  60.     GLsizei               width;
  61.     GLsizei               height;
  62.  
  63.     Colormap              colormap;
  64.     Window                glxWindow;
  65.     GLXContext            glxContext;
  66.     XVisualInfo           *glxVisual;
  67.  
  68.     struct _auxWindow     *prev;
  69.     struct _auxWindow     *next;
  70.  
  71. }    auxWindow;
  72.  
  73.  
  74. /**************************************************************************
  75.  *   auxState - Global state structure for windows
  76.  **************************************************************************/
  77.  
  78. typedef struct {
  79.  
  80.     /*
  81.      *   Generic X stuff ...
  82.      */
  83.  
  84.     Display        *display;
  85.     Screen         *screen;
  86.     Window         rootWindow;
  87.     int            screenNum;
  88.     Colormap       rgbColormap;
  89.     Colormap       indexColormap;
  90.  
  91.     /*
  92.      *   Program state variables
  93.      */
  94.  
  95.     auxWindow      *current;
  96.     auxWindow      *head;
  97.     auxWindow      *tail;
  98.  
  99. }    _auxState;
  100.  
  101.  
  102. /*************************************************************************
  103.  *   Mouse callback data structure - linked list refereced by mouse button
  104.  *      and mouse direction
  105.  **************************************************************************/
  106.  
  107. typedef struct _funcList {
  108.  
  109.     GLvoid              (*func)( AUX_EVENTREC * );
  110.  
  111.     struct _funcList    *prev;
  112.     struct _funcList    *next;
  113.  
  114. }    MouseFunc;
  115.  
  116.  
  117. /*************************************************************************
  118.  *   Key callback data structure - binary tree of functions referenced
  119.  *      by AUX key type.
  120.  **************************************************************************/
  121.  
  122. typedef struct _keyFunc {
  123.     
  124.     GLint        key;
  125.     GLvoid      (*keyFunc)( GLvoid );
  126.  
  127.     struct _keyFunc    *left;
  128.     struct _keyFunc    *right;
  129.  
  130. }    KeyFunc;
  131.  
  132.  
  133. /*************************************************************************
  134.  *   Font data structure - linked list index by a reference number referring
  135.  *      particular font of interest.
  136.  **************************************************************************/
  137.  
  138. typedef struct _fontInfo {
  139.     
  140.     GLint              fontId;
  141.     XFontStruct        *xFontInfo;
  142.     GLuint             listBase;
  143.     GLint              firstChar;
  144.  
  145.     struct _fontInfo   *prev;
  146.     struct _fontInfo   *next;
  147.  
  148. }    FontInfo;
  149.  
  150.  
  151. /*************************************************************************
  152.  *   Global variables
  153.  **************************************************************************/
  154.  
  155. #ifdef auxMain
  156. _auxState           auxState;
  157. GLboolean           auxInitCalled;
  158. GLint               auxDevice;
  159. GLint               auxValue;
  160. GLint               auxMouseX;
  161. GLint               auxMouseY;
  162. KeyFunc             *keyHead;
  163. MouseFunc           *mouseLoc;
  164. MouseFunc           *mouseUp[NUM_MOUSE_BUTTONS] = { NULL, NULL, NULL };
  165. MouseFunc           *mouseDown[NUM_MOUSE_BUTTONS] = { NULL, NULL, NULL };
  166. FontInfo            *fontHead;
  167. #else
  168. extern _auxState    auxState;
  169. extern GLboolean    auxInitCalled;
  170. extern GLint        auxDevice;
  171. extern GLint        auxValue;
  172. extern GLint        auxMouseX;
  173. extern GLint        auxMouseY;
  174. extern KeyFunc      *keyHead;
  175. extern MouseFunc    *mouseLoc;
  176. extern MouseFunc    *mouseUp[NUM_MOUSE_BUTTONS];
  177. extern MouseFunc    *mouseDown[NUM_MOUSE_BUTTONS];
  178. extern FontInfo     *fontHead;
  179. extern GLvoid       auxQuit( GLvoid );
  180. #endif
  181.  
  182.  
  183. /**************************************************************************
  184.  *   aux Library Private Function Prototypes
  185.  **************************************************************************/
  186.  
  187. GLvoid          auxInit( GLvoid );
  188. auxWindow      *auxGetWindow( GLint );
  189. GLvoid          auxCleanup( GLvoid );
  190.